import { createRouter, createWebHashHistory } from 'vue-router';

const routes = [
  {
    path: '/',
    name: 'Home',
    meta: {
      title: '首页',
    },
    component: () => import('@/pages/Home.vue'),
  },
  {
    path: '/register',
    name: 'register',
    meta: {
      title: '注册',
    },
    component: () => import('@/pages/Register.vue'),
  },
  {
    path: '/myProfile',
    name: 'myProfile',
    meta: {
      title: '个人资料',
    },
    component: () => import('@/pages/update-profile.vue'),
  },
  {
    path: '/china-map',
    name: 'china-map',
    meta: {
      title: '创作者地图',
    },
    component: () => import('@/pages/china-map.vue'),
  },
  {
    path: '/program-list',
    name: 'program-list',
    meta: {
      title: '节目单',
    },
    component: () => import('@/pages/program-list.vue'),
  },
  {
    path: '/video-library',
    name: 'video-library',
    meta: {
      title: '热门作品',
    },
    component: () => import('@/pages/video-library.vue'),
  },
  {
    path: '/video/:id',
    name: 'video-detail',
    meta: {
      title: '详情页',
    },
    component: () => import('@/pages/video-detail.vue'),
  },
  {
    path: '/tickets',
    name: 'Tickets',
    meta: {
      title: '入场券',
    },
    component: () => import('@/pages/web-mobile.vue'),
  },
  {
    path: '/homepage',
    name: 'homepage',
    meta: {
      title: '个人主页',
    },
    component: () => import('@/pages/personal-homepage.vue'),
  },
  {
    path: '/video-upload',
    name: 'video-upload',
    meta: {
      title: '视频上传',
    },
    component: () => import('@/pages/video-upload.vue'),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

router.beforeEach((to, from, next) => {
  console.log(to);
  next();
});

export default router;